phys_to_mach and mach_to_phys tables contain long entries, not
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 6 Sep 2005 18:01:24 +0000 (18:01 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 6 Sep 2005 18:01:24 +0000 (18:01 +0000)
32-bit entries.

Signed-off-by: Keir Fraser <keir@xensource.com>
15 files changed:
linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c
linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
tools/libxc/xc_linux_build.c
xen/arch/x86/domain_build.c
xen/arch/x86/mm.c
xen/arch/x86/x86_32/mm.c
xen/arch/x86/x86_64/mm.c
xen/include/asm-x86/mm.h
xen/include/public/arch-x86_32.h
xen/include/public/arch-x86_64.h

index 611cd676950a5f385064c024afa9201cda9afad9..2479d879727259dfcabb6e9f278514c65f1911d4 100644 (file)
@@ -359,7 +359,7 @@ static void __init probe_roms(void)
 shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
 EXPORT_SYMBOL(HYPERVISOR_shared_info);
 
-unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
+unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
 EXPORT_SYMBOL(phys_to_machine_mapping);
 
 /* Raw start-of-day parameters from the hypervisor. */
@@ -1206,7 +1206,7 @@ void __init setup_bootmem_allocator(void)
        }
 #endif
 
-       phys_to_machine_mapping = (unsigned int *)xen_start_info->mfn_list;
+       phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list;
 }
 
 /*
@@ -1638,15 +1638,15 @@ void __init setup_arch(char **cmdline_p)
        /* Make sure we have a correctly sized P->M table. */
        if (max_pfn != xen_start_info->nr_pages) {
                phys_to_machine_mapping = alloc_bootmem_low_pages(
-                       max_pfn * sizeof(unsigned int));
+                       max_pfn * sizeof(unsigned long));
 
                if (max_pfn > xen_start_info->nr_pages) {
                        /* set to INVALID_P2M_ENTRY */
                        memset(phys_to_machine_mapping, ~0,
-                               max_pfn * sizeof(unsigned int));
+                               max_pfn * sizeof(unsigned long));
                        memcpy(phys_to_machine_mapping,
-                               (unsigned int *)xen_start_info->mfn_list,
-                               xen_start_info->nr_pages * sizeof(unsigned int));
+                               (unsigned long *)xen_start_info->mfn_list,
+                               xen_start_info->nr_pages * sizeof(unsigned long));
                } else {
                        struct xen_memory_reservation reservation = {
                                .extent_start = (unsigned long *)xen_start_info->mfn_list + max_pfn,
@@ -1656,9 +1656,8 @@ void __init setup_arch(char **cmdline_p)
                        };
 
                        memcpy(phys_to_machine_mapping,
-                               (unsigned int *)xen_start_info->mfn_list,
-                               max_pfn * sizeof(unsigned int));
-                       /* N.B. below relies on sizeof(int) == sizeof(long). */
+                               (unsigned long *)xen_start_info->mfn_list,
+                               max_pfn * sizeof(unsigned long));
                        BUG_ON(HYPERVISOR_memory_op(
                                XENMEM_decrease_reservation,
                                &reservation) !=
@@ -1667,11 +1666,11 @@ void __init setup_arch(char **cmdline_p)
                free_bootmem(
                        __pa(xen_start_info->mfn_list), 
                        PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
-                       sizeof(unsigned int))));
+                       sizeof(unsigned long))));
        }
 
        pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
-       for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned int)), j++ )
+       for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
        {       
             pfn_to_mfn_frame_list[j] = 
                  virt_to_mfn(&phys_to_machine_mapping[i]);
index 1c942548e151d0b52a173d30c416132a3b907c59..50e645a69fe0639dc4418e047c306833d1bf8786 100644 (file)
@@ -81,7 +81,7 @@ static int __do_suspend(void *ignore)
     extern void time_suspend(void);
     extern void time_resume(void);
     extern unsigned long max_pfn;
-    extern unsigned int *pfn_to_mfn_frame_list;
+    extern unsigned long *pfn_to_mfn_frame_list;
 
 #ifdef CONFIG_SMP
     extern void smp_suspend(void);
index 68e79771c05b49eb4c3ed969beae736d3c94453d..734b9d3082135a3df86cecfa51e026da4ad27bc0 100644 (file)
@@ -90,7 +90,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
 {
        int i;
 
-        phys_to_machine_mapping = (u32 *)xen_start_info->mfn_list;
+        phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list;
         start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) + 
                xen_start_info->nr_pt_frames;
 
index ca1225eb6f445f62b2adf6f0019929897a34633d..05dab06d4a8b817dc8f968a4fb9faa2457ccc8ed 100644 (file)
@@ -76,7 +76,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
 /* Allows setting of maximum possible memory size  */
 unsigned long xen_override_max_pfn;
 
-u32 *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
+unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
 
 EXPORT_SYMBOL(phys_to_machine_mapping);
 
@@ -734,22 +734,22 @@ void __init setup_arch(char **cmdline_p)
                /* Make sure we have a large enough P->M table. */
                if (end_pfn > xen_start_info->nr_pages) {
                        phys_to_machine_mapping = alloc_bootmem(
-                               end_pfn * sizeof(u32));
+                               end_pfn * sizeof(unsigned long));
                        memset(phys_to_machine_mapping, ~0,
-                              end_pfn * sizeof(u32));
+                              end_pfn * sizeof(unsigned long));
                        memcpy(phys_to_machine_mapping,
-                              (u32 *)xen_start_info->mfn_list,
-                              xen_start_info->nr_pages * sizeof(u32));
+                              (unsigned long *)xen_start_info->mfn_list,
+                              xen_start_info->nr_pages * sizeof(unsigned long));
                        free_bootmem(
                                __pa(xen_start_info->mfn_list), 
                                PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
-                                               sizeof(u32))));
+                                               sizeof(unsigned long))));
                }
 
                pfn_to_mfn_frame_list = alloc_bootmem(PAGE_SIZE);
 
-               for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(u32)), j++ )
-                       pfn_to_mfn_frame_list[j] = 
+               for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
+                       pfn_to_mfn_frame_list[j] =
                                virt_to_mfn(&phys_to_machine_mapping[i]);
        }
 #endif
index 1bcc85e465fc6be9eedac081968585a3f0a865f4..788aa0637ba802c16d17aa4483d06e67b53f5074 100644 (file)
 #define copy_user_page(to, from, vaddr, pg)    copy_page(to, from)
 
 /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
-#define INVALID_P2M_ENTRY      (~0U)
-#define FOREIGN_FRAME(m)       ((m) | 0x80000000U)
-extern unsigned int *phys_to_machine_mapping;
+#define INVALID_P2M_ENTRY      (~0UL)
+#define FOREIGN_FRAME(m)       ((m) | (1UL<<31))
+extern unsigned long *phys_to_machine_mapping;
 #define pfn_to_mfn(pfn)        \
-((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL)
+(phys_to_machine_mapping[(unsigned int)(pfn)] & ~(1UL<<31))
 static inline unsigned long mfn_to_pfn(unsigned long mfn)
 {
-       unsigned int pfn;
+       unsigned long pfn;
 
        /*
         * The array access can fail (e.g., device space beyond end of RAM).
@@ -83,7 +83,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
                ".previous"
                : "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) );
 
-       return (unsigned long)pfn;
+       return pfn;
 }
 
 /* Definitions for machine and pseudophysical addresses. */
index 96d51075481a5f3c8be2919c7e3fefe3c3a6b860..fd7a675488b39af89109719d311ad6323da694ab 100644 (file)
@@ -62,14 +62,14 @@ void copy_page(void *, void *);
 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
 
 /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
-#define INVALID_P2M_ENTRY      (~0U)
-#define FOREIGN_FRAME(m)       ((m) | 0x80000000U)
-extern u32 *phys_to_machine_mapping;
+#define INVALID_P2M_ENTRY      (~0UL)
+#define FOREIGN_FRAME(m)       ((m) | (1UL<<63))
+extern unsigned long *phys_to_machine_mapping;
 #define pfn_to_mfn(pfn)        \
-((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL)
+(phys_to_machine_mapping[(unsigned int)(pfn)] & ~(1UL << 63))
 static inline unsigned long mfn_to_pfn(unsigned long mfn)
 {
-       unsigned int pfn;
+       unsigned long pfn;
 
        /*
         * The array access can fail (e.g., device space beyond end of RAM).
@@ -77,7 +77,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
         * but we must handle the fault without crashing!
         */
        asm (
-               "1:     movl %1,%k0\n"
+               "1:     movq %1,%0\n"
                "2:\n"
                ".section __ex_table,\"a\"\n"
                "       .align 8\n"
@@ -85,7 +85,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
                ".previous"
                : "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) );
 
-       return (unsigned long)pfn;
+       return pfn;
 }
 
 /* Definitions for machine and pseudophysical addresses. */
index e07b8810b3f7db544bc1404d37fe4a4d81af5909..e8f986c4527184d9a6533474f5684fb1c279c1b3 100644 (file)
@@ -307,7 +307,7 @@ inline static void set_pte_at(struct mm_struct *mm, unsigned long addr,
 #define pte_pfn(_pte)                                                  \
 ({                                                                     \
        unsigned long mfn = pte_mfn(_pte);                              \
-       unsigned pfn = mfn_to_pfn(mfn);                                 \
+       unsigned long pfn = mfn_to_pfn(mfn);                            \
        if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
                pfn = max_mapnr; /* special: force !pfn_valid() */      \
        pfn;                                                            \
index aa6e78156ec7466cdf5a4f63b4b8e24fa1fe0e25..e8e24edc160f5c9fa8e2912cdc3a1250ac2cbf71 100644 (file)
@@ -348,7 +348,7 @@ static int setup_guest(int xc_handle,
 
     unsigned long nr_pt_pages;
     unsigned long physmap_pfn;
-    u32 *physmap, *physmap_e;
+    unsigned long *physmap, *physmap_e;
 
     struct load_funcs load_funcs;
     struct domain_setup_info dsi;
index 0b9cbb1b29bff9f03eba6a79b77933d1e5743f31..98a7ec090203a14563e246f0750dc60a83c800a3 100644 (file)
@@ -218,7 +218,7 @@ int construct_dom0(struct domain *d,
     vinitrd_start    = round_pgup(dsi.v_end);
     vinitrd_end      = vinitrd_start + initrd_len;
     vphysmap_start   = round_pgup(vinitrd_end);
-    vphysmap_end     = vphysmap_start + (nr_pages * sizeof(u32));
+    vphysmap_end     = vphysmap_start + (nr_pages * sizeof(unsigned long));
     vstartinfo_start = round_pgup(vphysmap_end);
     vstartinfo_end   = vstartinfo_start + PAGE_SIZE;
     vpt_start        = vstartinfo_end;
@@ -613,7 +613,7 @@ int construct_dom0(struct domain *d,
         if ( !opt_dom0_translate && (pfn > REVERSE_START) )
             mfn = alloc_epfn - (pfn - REVERSE_START);
 #endif
-        ((u32 *)vphysmap_start)[pfn] = mfn;
+        ((unsigned long *)vphysmap_start)[pfn] = mfn;
         set_pfn_from_mfn(mfn, pfn);
     }
     while ( pfn < nr_pages )
@@ -626,7 +626,7 @@ int construct_dom0(struct domain *d,
 #ifndef NDEBUG
 #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
 #endif
-            ((u32 *)vphysmap_start)[pfn] = mfn;
+            ((unsigned long *)vphysmap_start)[pfn] = mfn;
             set_pfn_from_mfn(mfn, pfn);
 #undef pfn
             page++; pfn++;
index 119906b132410eeeca9decbec8f0dcca769f8240..41fd4711273f8c1e6ceafd3cc3e1ec3e24607d52 100644 (file)
@@ -1450,7 +1450,7 @@ int get_page_type(struct pfn_info *page, unsigned long type)
                          ((type & PGT_type_mask) != PGT_l1_page_table) )
                         MEM_LOG("Bad type (saw %" PRtype_info
                                 "!= exp %" PRtype_info ") "
-                                "for mfn %lx (pfn %x)",
+                                "for mfn %lx (pfn %lx)",
                                 x, type, page_to_pfn(page),
                                 get_pfn_from_mfn(page_to_pfn(page)));
                     return 0;
index bd67cf5421cccb69865205b38cb2a4f2680e91e6..002b9f8bc61a7a494496a966287fcd8a47fa49eb 100644 (file)
@@ -95,7 +95,7 @@ void __init paging_init(void)
      * Allocate and map the machine-to-phys table and create read-only mapping 
      * of MPT for guest-OS use.
      */
-    mpt_size  = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
+    mpt_size  = (max_page * BYTES_PER_LONG) + (1UL << L2_PAGETABLE_SHIFT) - 1;
     mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
index 5233c92b9ffba738ba92f614388b186a0d997201..76b35181114864124231586fe3224a15bac98a9e 100644 (file)
@@ -98,7 +98,7 @@ void __init paging_init(void)
      * Allocate and map the machine-to-phys table.
      * This also ensures L3 is present for fixmaps.
      */
-    mpt_size  = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
+    mpt_size  = (max_page * BYTES_PER_LONG) + (1UL << L2_PAGETABLE_SHIFT) - 1;
     mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
index d2e66253ccfa12d3cbd5bf34c5612b46c4fe20df..4b7eb641ff38680089d177089e7b6da760eb0ac7 100644 (file)
@@ -255,9 +255,9 @@ int check_descriptor(struct desc_struct *d);
  * contiguous (or near contiguous) physical memory.
  */
 #undef  machine_to_phys_mapping
-#define machine_to_phys_mapping  ((u32 *)RDWR_MPT_VIRT_START)
-#define INVALID_M2P_ENTRY        (~0U)
-#define VALID_M2P(_e)            (!((_e) & (1U<<31)))
+#define machine_to_phys_mapping  ((unsigned long *)RDWR_MPT_VIRT_START)
+#define INVALID_M2P_ENTRY        (~0UL)
+#define VALID_M2P(_e)            (!((_e) & (1UL<<(BITS_PER_LONG-1))))
 #define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
 
 #define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
index 2c7b0db362c778b34a9e5f8a8f3e64b9e91af9af..cf0a43c50c928bb2bb6cb3a0e24177728cc7aaf3 100644 (file)
@@ -55,7 +55,7 @@
 # define HYPERVISOR_VIRT_START (0xFC000000UL)
 #endif
 #ifndef machine_to_phys_mapping
-#define machine_to_phys_mapping ((u32 *)HYPERVISOR_VIRT_START)
+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
 #endif
 
 /* Maximum number of virtual CPUs in multi-processor guests. */
index 4594b946a724a02f852c5424d4c562ea4092da13..81b1ecd6fda4473d5e94848b02b41df9c8022bed 100644 (file)
@@ -71,7 +71,7 @@
 
 /* The machine->physical mapping table starts at this address, read-only. */
 #ifndef machine_to_phys_mapping
-#define machine_to_phys_mapping ((u32 *)HYPERVISOR_VIRT_START)
+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
 #endif
 
 /*